<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>set</title>
</head>
<body>
    <script>
      
        //基本操作
        // let arr =[...new Set([1,1,1,2,2,2,3,3,3])];
        // console.log(arr);


        //1、数组去重
        // let nums =[1,2,3,4,3,21,43,];
        // let set =new Set(nums);
        // let res =[...set];
        // console.log(res);

        //2、数组交集
        // let nums1 =[1,5,2,3,4,9,5,7];
        // let nums2 = [1,3,2,5,6,7,5];

        // let res1 =[...new Set(nums1)].filter(item =>
        //      new Set(nums2).has(item)
        // )

         //2、数组并集

         let union =[...new Set([...new Set(nums1)],[...new Set(nums2)])]

        console.log(res1);

    </script>
</body>
</html>